package com.itheima.mapper;

import com.itheima.pojo.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description DeptMapper
 * @Author songyu
 * @Date 2024-01-23
 */
@Mapper
public interface DeptMapper {

    /**
     * 查询部门列表
     * @return
     */
    @Select("select * from dept order by create_time asc")
    List<Dept> list();

    /**
     * 根据id删除部门
     * @param id
     */
    @Delete("delete from dept where id = #{id}")
    void delete(Integer id);

    /**
     * 添加部门方法
     * @param dept
     */
    void insert(Dept dept);

    @Select("select * from dept where id=#{id}")
    Dept findById(Integer id);

    void update(Dept dept);
}
